<?php
namespace app\store\controller;
use think\Db;

/**
 * 客服消息管理
 * Class Index
 * @package app\store\controller
 */
class Customer extends Controller
{	
	public function index(){
		$list = db('customer')->select();
		return $this->fetch('list', compact('list'));
	}
	// 新增，编辑
	public function save(){
		$params = $this->request->param();
		if(!isset($params['id'])){
			$params['date'] = time();
			return db('customer')->insert($params);
		}
		return db('customer')->where('id',$params['id'])->update([
				'keywords'=>$params['keywords'],
				'content'=>$params['content'],
				'type'=>$params['type']
			]);
	}
	// 删除
	public function del(){
		$params = $this->request->param();
		return db('customer')->where('id',$params['id'])->delete();
	}
}

?>